package com.loie.xcx.comm;

import lombok.Data;

import java.io.Serializable;

/**
 * @author zhl
 */
@Data
public class JsonResult<T> implements Serializable {
    private static final long serialVersionUID = -3136052538356961560L;
    public static Integer OK = 200;
    public static Integer FAILURE = 300;
    public static Integer ERROR = 400;

    private Integer errorCode;
    private String errorMessage;
    private T data;

    private boolean success;

    public JsonResult() {
        this.errorMessage = "";
        this.success = true;
    }

    public JsonResult(T result) {
        this.data = result;
        this.errorMessage = "";
        this.success = true;
    }

    public JsonResult(Integer errorCode, String errMsg) {
        this.errorCode = errorCode;
        this.errorMessage = errMsg;
        this.success = false;
    }


}
